package org.example.ymcc.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.example.ymcc.constant.RConst;
import org.example.ymcc.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

@RequestMapping("/common")
@RestController
public class CommonController {
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    @GetMapping("/createToken")
    public JsonResult createToken(){
        String token = UUID.randomUUID().toString();
        redisTemplate.opsForValue().set(token,"11111", RConst.Num.INT_5, TimeUnit.MINUTES);
        return JsonResult.success().setData(token);
    }
}
